package de.uebungen.grabo;

import java.awt.ComponentOrientation;
import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class Tastatur extends JPanel {

	public Tastatur() {
		Dimension dim = new Dimension(60, 30);
		this.setLayout(new GridLayout(3, 3));
		this.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
		for(int i = 9; 0 < i; i--) {
			JButton button = new JButton(String.valueOf(i));
			button.setPreferredSize(dim);
			button.setVisible(true);
			if(i != 5)
			{
				button.addActionListener(new ListenerBewegung());
				this.add(button);
			}
			else
			{
				button.addActionListener(new ListenerWaffe());
				this.add(button);
			}
		}
		this.setVisible(true);
	}
}
